package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorFormDao;
import com.xbongbong.admin.domain.entity.MirrorFormEntity;
import com.xbongbong.admin.model.MirrorFormModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author xingxing.xiao
 */
@Service("mirrorFormModel")
public class MirrorFormModelImpl implements MirrorFormModel {

    @Resource
    private MirrorFormDao mirrorFormDao;

    @Override
    public Integer insert(MirrorFormEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorFormDao.insert(entity);
    }

    @Override
    public Integer update(MirrorFormEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorFormDao.update(entity);
    }

    @Override
    public List<MirrorFormEntity> findEntitys(Map<String, Object> param) {
        return mirrorFormDao.findEntitys(param);
    }

    @Override
    public List<MirrorFormEntity> insertBatch(List<MirrorFormEntity> list) {
        mirrorFormDao.insertBatch(list);
        return list;
    }

    @Override
    public MirrorFormEntity getByMirrorMenuId(Long mirrorMenuId, Long mirrorId) {
        return mirrorFormDao.getByMirrorMenuId(mirrorMenuId, mirrorId);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorFormDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
